package com.igoal.dao;

import java.util.List;

import com.igoal.entity.UserGoalDone;
import com.igoal.entity.UserGoalPk;

/**
 * DAO for {@link UserGoalDone} entity
 * @author Tri
 * @since 6/19/2010
 */
public interface UserGoalEntryDoneDAO extends GenericDao<UserGoalDone, Long> {
	/**
	 * Find by foreign key
	 * @param userId user identifier
	 * @param goalId goal identifier
	 * @return list of {@link UserGoalEntry}
	 */
	List<UserGoalDone> findByFK(Long userId, Long goalId);
	
	/**
	 * Find by foreign key
	 * @param fk {@link UserGoalPk} userGoal primary key
	 * @return list of {@link UserGoalEntry}
	 */
	List<UserGoalDone> findByFK(UserGoalPk fk);
	
	/**
	 * Find list of done entries of a goal by order property in descending
	 * @param goalId
	 * @param numberOfEntries number of entries want to get
	 * @param orderBy property use to order
	 * @return list of {@link UserGoalDone}
	 */
	List<UserGoalDone> listDoneEntriesByGoal(Long goalId, int numberOfEntries, String orderBy);
	
	List<UserGoalDone> listDoneEntriesByUser(Long userId, int numberOfEntries, String orderBy);
	
	int countDoneEntries(Long userId);
}
